package com.iwhalecloud.citybrain.flow.platform.manager.infrastructure.mapper;

import java.util.List;

import com.iwhalecloud.citybrain.flow.platform.manager.common.client.HttpFlowQueryInfoDto;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.FlowExecutionQueryLink;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.task.FlowExecutionQueryVo;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.FlowExecutionQueryInfo;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.ProcessQueryVo;

/**
 * @author lilh
 * @date 2019-01-24 14:24
 */
public interface FlowExecutionQueryDAO {

    List<FlowExecutionQueryInfo> todoTasks(FlowExecutionQueryVo flowExecutionQueryVo);

    List<HttpFlowQueryInfoDto> todoTasksByModelKey(HttpFlowQueryInfoDto httpFlowQueryInfoDto);

    int todoCount(FlowExecutionQueryVo flowExecutionQueryVo);

    int countProcessed(FlowExecutionQueryVo flowExecutionQueryVo);

    int countLaunchedProcess(FlowExecutionQueryVo flowExecutionQueryVo);

    List<FlowExecutionQueryInfo> processedProcessInstance(FlowExecutionQueryVo flowExecutionQueryVo);

    List<FlowExecutionQueryInfo> launchedProcessInstance(FlowExecutionQueryVo flowExecutionQueryVo);

    List<FlowExecutionQueryInfo> listExecutingProcess(ProcessQueryVo processQueryVo);

    int countCompletedProcess(ProcessQueryVo processQueryVo);

    List<FlowExecutionQueryInfo> listCompletedProcess(ProcessQueryVo processQueryVo);

    int countExecutingProcess(ProcessQueryVo processQueryVo);

    List<FlowExecutionQueryInfo> listAbnormalProcess(ProcessQueryVo processQueryVo);

    int countAbnormalProcess(ProcessQueryVo processQueryVo);

    List<String> selectAssign(FlowExecutionQueryVo flowExecutionQueryVo);

    /**
     * 从act_ru_task表中根据流程实例id查找当前任务处理人
     * @param flowExecutionQueryVo
     * @return
     */
    List<String> queryAssign(FlowExecutionQueryVo flowExecutionQueryVo);
    /**
     * 根据流程实例id查找act_ru_identityLink
     * @param flowExecutionQueryVo
     * @return
     */
    List<FlowExecutionQueryLink> queryIdentityLinkByProcessInstanceId(FlowExecutionQueryVo flowExecutionQueryVo);

    /**
     * 根据任务id查找act_ru_identityLink获取任务处理人（包括角色、组织、岗位）
     * @param taskId
     * @return
     */
    List<FlowExecutionQueryLink> queryIdentityLinkByTaskId(String taskId);

    List<String> queryCandidate(FlowExecutionQueryVo flowExecutionQueryVo);

    List<String> queryFlow(FlowExecutionQueryVo flowExecutionQueryVo);

    List<String> selectCandidate(FlowExecutionQueryVo flowExecutionQueryVo);

    /**
     * 获取流程实例列表
     *
     * @param flowExecutionQueryVo
     * @return
     */
    List<FlowExecutionQueryInfo> getProcessInstanceList(FlowExecutionQueryVo flowExecutionQueryVo);
    /**
     * 获取流程实例列表
     *
     * @param flowExecutionQueryVo
     * @return
     */
    List<FlowExecutionQueryInfo> getSingleProcessInstanceList(FlowExecutionQueryVo flowExecutionQueryVo);

}
